<?xml version="1.0" encoding="ISO-8859-1" ?>

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<%@include file="../../context.jsp"%>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Dividend Data List</title>
<%@include file="../common_Admin_imports.jsp"%>
<%@include file="../common_list_page.jsp"%>

<script type="text/javascript">
	$(document)
			.ready(
					function() {
						resetSelectAll();
						$('#selectAll').on('click', function() {
							selectAll();
						});
						paginationNextBtn("${pageContext.request.contextPath}/admin/dividend/list.html?totalRecords=${dividendDataPage.totalNoOfRecords}&page=");
					});
	function deleteFiltered() {
		var proceed = confirm("Are you sure, you want to delete the searched dataset ? If you select yes, the operation cannot be undone");
		if (proceed) {
			var baseUrl = "${pageContext.request.contextPath}/admin/dividend/deleteFiltered.html";
			document.location = baseUrl;
		}

		return proceed;
	}
</script>
<style type="text/css">
.datepicker,.searchSelector {
	margin-right: 10px;
	width: 100px;
}

.searchSelector {
	margin-right: 10px;
	width: 150px;
}

.btnSerch {
	padding: 4px;
}
</style>
</head>
<body>
	<div class="main_wrapper">
		<div class="header_wrapper">
			<div class="container-fluid">
				<div class="header_inner_wrapper clearfix">
					<div class="row-fluid">
						<div class="header_left span4">List of Dividend Data</div>
						<div class="header_right span8">
							<div class="input-append">
								<!-- search section -->
								<form:form method="POST" commandName="criteria"
									action="${pageContext.request.contextPath}/admin/dividend/search.html">
									<form:input cssClass="datepicker" path="fromDate"
										id="fromDatepicker" />
									<form:input cssClass="datepicker" path="toDate"
										id="toDatepicker" />
									<form:select cssClass="searchSelector" path="companyId">
										<form:option value="-1">--ANY--</form:option>
										<form:options itemValue="id" itemLabel="name"
											items="${companyMap}" />
									</form:select>
									<input class="btnSerch btn-info" type="submit" value="Search" />
								</form:form>
								<!-- end of search section -->
							</div>
							<jsp:include page="../common_link.jsp" />
						</div>
					</div>
				</div>

				<div class="row-fluid">
					<div class="main_table">
						<table class="table table-bordered table-striped">
							<thead>
								<tr>
									<th id="tableHeader">No</th>
									<th id="tableHeader">Company Name</th>
									<th id="tableHeader">Date</th>
									<th id="tableHeader">Dividend per share</th>
									<th id="tableHeader">Adjusted Dividend per share</th>
									<th id="tableHeader">RIGHTS ISSUE</th>
									<th id="tableHeader">STOCK SPLITS</th>
									<th id="tableHeader">BONUS ISSUES</th>
									<th></th>
									<th></th>
								</tr>
							</thead>
							<tbody>
								<c:forEach var="dividend" items="${dividendDataPage.pageData}">
									<tr>
										<td>${dividend.id}</td>
										<td>${dividend.company.name}</td>
										<td id="dateAlign"><fmt:formatDate
												pattern="${dateFormat}" value="${dividend.date}" /></td>
										<td id="numberAlign"><fmt:formatNumber
												maxFractionDigits="${MaxFraction}"
												minFractionDigits="${MinFraction}"
												value="${dividend.dividedPShare}" /></td>
										<td id="numberAlign"><fmt:formatNumber
												maxFractionDigits="${MaxFraction}"
												minFractionDigits="${MinFraction}"
												value="${dividend.adjDividedPShare}" /></td>
										<td id="numberAlign">${dividend.rightsIssues}</td>
										<td id="numberAlign">${dividend.stockSplits}</td>
										<td id="numberAlign">${dividend.bonusIssues}</td>
										<td><a class="btn btn-info"
											href="${pageContext.request.contextPath}/admin/dividend/edit/${dividend.id}.html">Edit</a>
										</td>
										<td><a class="btn btn-danger"
											lang="${pageContext.request.contextPath}/admin/dividend/delete/${dividend.id}.html"
											href="javascript:void(0);"
											onclick="return confirmAndDelete(this);">Delete</a></td>
									</tr>
								</c:forEach>
							</tbody>
						</table>
						<!-- paging section -->
						<div class="pagination pagination-right">
							<ul>
								<li><c:if test="${dividendDataPage.showPrev}">
										<a
											href="${pageContext.request.contextPath}/admin/dividend/list.html?page=${dividendDataPage.currentPageNo-1}&totalRecords=${monthlyShareDataPage.totalNoOfRecords}">Prev</a>
									</c:if></li>
								<c:forEach begin="${dividendDataPage.startPageNo}" var="page"
									end="${dividendDataPage.endPageNo}">
									<li><a
										<c:if test="${dividendDataPage.currentPageNo==page}">style="background-color:#79BAEC"</c:if>
										href="${pageContext.request.contextPath}/admin/dividend/list.html?page=${page}&totalRecords=${dividendDataPage.totalNoOfRecords}">${page}</a></li>&nbsp;
							</c:forEach>
								<li><c:if test="${dividendDataPage.showNext}">
										<a
											href="${pageContext.request.contextPath}/admin/dividend/list.html?page=${dividendDataPage.currentPageNo+1}&totalRecords=${dividendDataPage.totalNoOfRecords}">Next</a>
									</c:if></li>
								<li><a class="pageCountLink">${dividendDataPage.totalNoOfPages }
										Pages</a></li>
							</ul>

						</div>
						<div>
							<br></br>
						</div>
						<!-- paging section -->
						<div class="btn btn-success">
							<a
								href="${pageContext.request.contextPath}/admin/dividend/add.html">New</a>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</body>
</html>